# l=[{'name':'alex'},{'name':'y'}]
# print(list(map(lambda x:{"name":x["name"]+"_sb"},l)))


# shares={
#  'IBM':36.6,
#  'Lenovo':23.2,
#  'oldboy':21.2,
#  'ocean':10.2,
#          }
# print(list(filter(lambda x:shares[x] > 20,shares)))

# portfolio = [
#   {'name': 'IBM', 'shares': 100, 'price': 91.1},
#     {'name': 'AAPL', 'shares': 50, 'price': 543.22},
#     {'name': 'FB', 'shares': 200, 'price': 21.09},
#     {'name': 'HPQ', 'shares': 35, 'price': 31.75},
#     {'name': 'YHOO', 'shares': 45, 'price': 16.35},
# {'name': 'ACME', 'shares': 75, 'price': 115.65}]
#
# # print(list(map(lambda x:x["shares"] * x["price"],portfolio)))
#
# print(list(filter(lambda x:x["price"] > 100,portfolio)))

# l1 = [1, 2, 3, 4, 5, 6]
# l2 = ['oldboy', 'alex', 'wusir', '太白', '日天']
# tu = ('**', '***', '****', '*******')
# print(list(filter(lambda x:x[0]>2 and len(x[2]) >=4,zip(l1,l2,tu))))

# l1 = [ {'sales_volumn': 0},
#        {'sales_volumn': 108},
#        {'sales_volumn': 337},
#        {'sales_volumn': 475},
#        {'sales_volumn': 396},
#        {'sales_volumn': 172},
#        {'sales_volumn': 9},
#        {'sales_volumn': 58},
#        {'sales_volumn': 272},
#        {'sales_volumn': 456},
#        {'sales_volumn': 440},
#        {'sales_volumn': 239}]
#
# print(sorted(l1,key=lambda x:x["sales_volumn"]))

# v = (lambda :x for x in range(10))
# print(v)
# print(v[0])
# print(v[0]())
# print(next(v))
# print(next(v))
# print(next(v)())


# def func():
#     for x in range(10): # 1
#         yield lambda :x
# g = func()  # 生成一个生成器

# print(list(map(str,[1,2,3,4,5,6,7,8,9])))

"""
10.有一个数组[34,1,2,5,6,6,5,4,3,3]请写一个函数，找出该数组中没有重复的数
的总和（上面数据的么有重复的总和为1+2+4+34=41)(面试题)
"""
# lst = [34,1,2,5,6,6,5,4,3,3]
# print(sum(filter(lambda x:lst.count(x) == 1,lst)))

# def num():
#     return [lambda x:i*x for i in range(4)]
# print([m(2)for m in num()])



# lst = []
# def num():
#     for i in range(4):
#         ret = lambda x: i * x
#         lst.append(ret)
#     return lst
#
# new_lst = []
# for m in num(): #  list
#     new_lst.append(m(2))
# print(new_lst)


# 没事自己研究一下
# def num():
#     return (lambda x:i*x for i in range(4))
# print([m(2)for m in num()])